<link href="../plugins/bootstrap/css/bootstrap.css" rel="stylesheet">
<link href="../plugins/bootstrap-fontAwesome/css/font-awesome.css">
<style>
    .panel-body label{
        font-size: 12px;;
    }
    .btn:focus,
    .btn:active:focus,
    .btn.active:focus,
    .btn.focus,
    .btn:active.focus,
    .btn.active.focus {
        outline: none;
    }
</style>
<div ng-controller="statisticCtrl">
    <div id="main" class="container">
        <div class="panel panel-default">
            <div class="panel-heading">
                <form class="form-inline">
                    <div class="form-group">
                        <label>
                            <select class="form-control" ng-model="currentTimeType"
                                    ng-options="s.value for s in selector.timeType"></select>
                        </label>
                        <label>
                            <input type="text" ng-model="startTime" class="form-control form_date"  style="width: 100px;">
                        </label>
                        <label class="glyphicon glyphicon-minus"></label>
                        <label>
                            <input type="text"  ng-model="endTime" class="form-control form_date"  style="width: 100px;">
                        </label>
                    </div>
                    <div class="form-group" style="margin-left: 10px;">
                        <label class="control-label">关键字：</label>
                        <label>
                            <input type="text" style="width: 400px;"  ng-model="searchInfo.searchKey" class="form-control" placeholder="请输入场馆ID/场馆Code/场馆名/负责人">
                        </label>
                        <button class="btn btn-default icon-search" title="点击查询" ng-click="loadResult()">&nbsp;确定</button>
                    </div>
                    <button ng-class="{true:'icon-angle-down',false:'icon-angle-up'}[selector.collapse]"
                            ng-click="selector.toggleCollapse()"
                            class="btn btn-default pull-right "
                            data-toggle="collapse"
                            aria-expanded="false"
                            data-target="#searchBody"
                            aria-controls="searchBody"
                            title="高级搜索">
                        更多
                    </button>
                </form>
            </div>
            <div id="searchBody" class="panel-body collapse" style="padding-bottom:0;">
                <div class="form-group" ng-repeat="c in conditions">
                    <div style="width: 90px;" class="pull-left col-lg-2 col-md-2 col-sm-2 col-xs-2">
                        <label>
                            {{c.title}}:
                        </label>
                    </div>
                    <div class="pull-left col-lg-10 col-md-10 col-sm-10 col-xs-10">
                        <button style="margin: 0 0 3px 3px;"
                                ng-class="{true:'btn-info'}[item.active]"
                                class="btn btn-default btn-xs"
                                ng-repeat="item in selector[c.key]"
                                ng-click="selector.click($index,c.key)">
                            {{item.value}}
                        </button>
                    </div>
                    <div class="clearfix"></div>
                </div>
                <hr>
                <div class="form-group">
                    <div style="width: 90px;" class="pull-left col-lg-2 col-md-2 col-sm-2 col-xs-2">
                        <label style="font-size: 15px;line-height: 40px;">
                            维度:
                        </label>
                    </div>
                    <div class="pull-left col-lg-10 col-md-10 col-sm-10 col-xs-10">
                        <button ng-mouseleave="dimensionOpt.leave()"
                                ng-mouseover="dimensionOpt.over('out')"
                                ng-click="dimensionOpt.select($index,'out')"
                                style="margin: 0 0 3px 3px;"
                                ng-repeat="dimension in selector.currentDimensions"
                                class="btn btn-info">
                            {{dimension.value}}
                        </button>
                        <span style="margin-left: 10px;">{{dimensionOpt.opt}}</span>
                        <button ng-mouseleave="dimensionOpt.leave()"
                                ng-mouseover="dimensionOpt.over('in')"
                                ng-click="dimensionOpt.select($index,'in')"
                                style="margin-left: 10px;"
                                ng-repeat="dimension in selector.dimensions"
                                class="btn btn-default">
                            {{dimension.value}}
                        </button>
                    </div>
                    <button class="btn btn-default icon-search pull-right" ng-click="loadResult()">&nbsp;搜索</button>
                    <div class="clearfix"></div>
                </div>
            </div>
        </div>
        <div class="panel panel-default" ng-hide="detailDisplay">
            <!-- Default panel contents -->
            <div class="panel-heading" style="padding: 5px 5px 0 10px;">
                <span class="pull-left h5">统计信息</span>
                <button class="btn btn-default btn-sm icon-cloud-download pull-right" title="导出维度报表" ng-click="exportResult()">&nbsp;导出维度报表</button>
                <button class="btn btn-default btn-sm icon-cloud-download pull-right" title="{{ex.name}}" ng-repeat="ex in exports.statistics" ng-click="customExport(ex)">&nbsp;{{ex.name}}</button>
                <div class="clearfix"></div>
            </div>
            <!-- Table -->
            <table class="table table-hover table-condensed ">
                <tr>
                    <th ng-repeat="d in titles">{{d}}</th>
                </tr>
                <tr ng-repeat="settle in results" ng-click="showDetail(settle)">
                    <td ng-repeat="col in settle.cols track by $index">{{col}}</td>
                </tr>
            </table>
        </div>
        <div class="panel panel-default" ng-show="detailDisplay">
            <!-- Default panel contents -->
            <div class="panel-heading" style="padding: 5px 5px 0 10px;">
                <span class="pull-left h5">订单信息</span>
                <button class="btn btn-default btn-sm icon-reply pull-right" title="返回" ng-click="closeDetail()">&nbsp;返回</button>
                <button class="btn btn-default btn-sm icon-cloud-download pull-right" title="{{ex.name}}" ng-repeat="ex in exports.orders" ng-click="customExport(ex)">&nbsp;{{ex.name}}</button>
                <div class="clearfix"></div>
            </div>
            <!-- Table -->
            <table class="table table-hover .table-condensed ">
                <tr>
                    <th>场馆</th>
                    <th>订单</th>
                    <th>金额</th>
                    <th>时间</th>
                    <th>场地</th>
                    <th>状态</th>
                </tr>
                <tr ng-repeat="od in orderDetail.list">
                    <td>
                        ID：{{od.shopId}}<br>
                        编号：{{od.shopCode}}<br>
                        {{od.shopName}}
                    </td>
                    <td>
                        订单号：{{od.orderId}}<br>
                        交易号：{{od.orderNumber}}
                    </td>
                    <td>
                        交易类型：{{od.payType!=null?od.payType:'免费'}}<br>
                        交易额：{{od.paySum}}<br>
                        补贴额：{{od.subsidySum}}
                    </td>
                    <td>
                        订：{{od.orderTime}}<br>
                        消：{{od.examineTime}}<br>
                        验：{{od.useTime}}
                    </td>
                    <td>
                        订单类型：{{od.orderType}}<br>
                        运动类型：{{od.sportsTypeName}}<br>
                        预定量：{{od.orderNum}}
                    </td>
                    <td>
                        订单状态：{{od.statusName}}<br>
                        结算状态：{{od.settleStatusName}}
                    </td>
                </tr>
            </table>
            <div class="panel-footer" style="padding: 5px 15px 2px;">
                <nav class="pull-right">
                    <ul class="pagination pagination-sm" style="margin: 0;">
                        <li ng-class="{'disabled':!orderDetail.hasPreviousPage}">
                            <a href="#" aria-label="Previous" ng-click="loadDetailByPage(orderDetail.pageNum-1)">
                                <span aria-hidden="true">上页</span>
                            </a>
                        </li>
                        <li ng-repeat="pageNum in orderDetail.navigatepageNums " ng-class="{'active':(pageNum==orderDetail.pageNum)}"><a href="#" ng-click="loadDetailByPage(pageNum)">{{pageNum}}</a></li>
                        <li ng-class="{'disabled':!orderDetail.hasNextPage}">
                            <a href="#" aria-label="Next" ng-click="loadDetailByPage(orderDetail.pageNum+1)">
                                <span aria-hidden="true">下页</span>
                            </a>
                        </li>
                    </ul>
                </nav>
                <div class="clearfix"></div>
            </div>
        </div>
    </div>
    <div>
        <form id="exportForm" method="post">
            <input type="hidden" name="timeType" value="{{searchInfo.timeType}}">
            <input type="hidden" name="startTime" value="{{startTime}}">
            <input type="hidden" name="endTime" value="{{endTime}}">
            <input type="hidden" name="orderStatus" value="{{searchInfo.orderStatus}}">
            <input type="hidden" name="shop" value="{{currentDetailParams.shop}}">
            <input type="hidden" name="sales" value="{{currentDetailParams.sales}}">
            <input type="hidden" name="payType" value="{{searchInfo.payType}}">
            <input type="hidden" name="orderType" value="{{searchInfo.orderType}}">
            <input type="hidden" name="city" value="{{searchInfo.city}}">
            <input type="hidden" name="sportsType" value="{{searchInfo.sportsType}}">
            <input type="hidden" name="searchKey" value="{{searchInfo.searchKey}}">
            <input type="hidden" name="groups" value="{{searchInfo.groups}}">
        </form>
    </div>
</div>

<script type="text/javascript">
    $('.form_date').datetimepicker({
        format: 'yyyy-mm-dd',
        language:  'zh-CN',
        weekStart: 1,
        todayBtn:  1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 2,
        minView: 2,
        forceParse: 0
    });
</script>